package org.hot100_6.leetcode189;

public class Solution {

    public static void main(String[] args) {
        int [] test = {1,2,3,4,5,6,7};

        rotate(test,3);
    }


    public static void rotate(int[] nums, int k) {
        int n = nums.length;
        int[] temp = new int[n];

        for (int i = 0; i < n; i++) {
            int newIndex = (i + k) % n;
            temp[newIndex] = nums[i];
        }

        for (int i = 0; i < n; i++) {
            nums[i]=temp[i];
        }
    }
}
